package com;

/**
 * @Package: com
 * @ClassName: DCLSingleton
 * @Author: wulongkai
 * @CreateTime: 2024/1/5 11:16
 * @Description:
 */
public class DCLSingleton {
    private static volatile DCLSingleton instance;

    private DCLSingleton() {
        throw new RuntimeException();
    }

    public static DCLSingleton getInstance() {
        if(instance == null) {
            synchronized (DCLSingleton.class) {
                if(instance == null) {
                    instance = new DCLSingleton();
                }
            }
        }
        return instance;
    }

    public static void main(String[] args) {
        DCLSingleton instance = DCLSingleton.getInstance();
    }
}


